<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>区域意向客户详情页</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_855021_i2jfy4r0uq.css">
    <script type="text/javascript" src="/dist/plugins/vue/vue.js"></script>
    <script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
</head>
<style>
    [v-cloak] {
        display: none;
    }

    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        font-size: 12px;
    }

    body {
        margin: 1px;
        background: #f8f8f8;
    }

    .boxBoy {
        background: #fff;
    }

    table {
        border-spacing: 0;
        border-collapse: collapse;
        display: table;
    }

    th {
        font-weight: normal;
    }

    table.text-center, table.text-center td, table.text-center th {
        text-align: center;
        font-size: 12px;
    }

    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #cbcbcd;
        height: 28px;
        /*position: relative;*/
        color: #2a8cec;
        padding: 0 4px;
    }

    table th {
        background: #f8f8f8;
    }

    .lable {
        width: 33%;
        height: 20px;
        line-height: 20px;
        display: block;
        float: left;
    }

    .table-bordered {
        border: 1px solid #cbcbcd;
    }

    .table {
        width: 100%;
        max-width: 100%;
    }

    .hidden {
        display: none;
    }

    .lineOne, .lineTwo {
        text-align: left;
    }

    .tdColor {
        background-color: #f8f8f8;
        font-weight: normal;
        color: #333 !important;
    }

    .lineOne span {
        max-height: 24px;
        line-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        text-align: left;
    }

    .lineTwo span {
        max-height: 55px;
        line-height: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        text-align: left;
        padding: 5px;

    }

    .div-td-content-more {
        position: absolute;
        height: auto;
        z-index: 999;
        line-height: 20px;
        background-color: #d3e8fd;
        padding: 8px 6px;
        border: 1px solid #e8e8ea;
        display: none;
    }

    .div-td-content-more i {
        width: 15px;
        height: 12px;
        background: url("/dist/img/more-icon.png");
        position: absolute;
        left: 50px;
        top: -12px;
    }

    .clear {
        clear: both
    }

    .boxItem {
        width: 100%;
        margin-top: -1px;
        padding-bottom: 0;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        position: relative;
    }

    .boxItemTitle {
        color: #2c8cec;
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 6px;
        text-align: center;
    }

    .home {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
        height: 14px;
        line-height: 14px;
        text-align: center;
    }

    .dian-icon {
        background: url("/dist/img/dian.png") no-repeat;
        background-size: cover;
        width: 14px;
        height: 14px;
        display: inline-block;
    }

    .jiaobiao, .jiaobiaoNew {
        position: relative;
    }

    .jiaobiao i {
        display: block;
        width: 0;
        height: 0;
        border-width: 0px 0 12px 12px;
        border-style: solid;
        border-color: transparent transparent transparent #2a8cec;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .jiaobiaoNew i {
        display: block;
        width: 12px;
        height: 12px;
        background: url("/dist/img/newLog2.png");
        background-size: 100% 100%;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .lineImg {
        padding-top: 5px !important;
        padding-bottom: 10px !important;
    }

    .lineImg img {
        height: 45px;
        width: 45px;
        float: left;
        margin: 10px;
        object-fit: cover;
    }

    .newCustomer {
        background: url(/dist/img/new.png) no-repeat;
        background-size: cover;
        width: 20px;
        height: 20px;
        right: 0;
        top: 2px;
        position: absolute;
    }

    .wajueji {
        padding-left: 140px;
        background: url("/dist/img/wajueji.png") no-repeat;
        background-size: 120px 88px;
        height: 88px;
        line-height: 88px;
        color: red;
        font-size: 14px;
        font-weight: bold;
        margin-left: 50px;
    }

    .qipao {
        /*background: url(/dist/img/qipao.png);*/
        background-size: 100% 100%;
        height: 88px;
        /* padding: 0 20px; */
        padding-left: 20px;
        /*padding-right: 20px;*/
        color: red;
        line-height: 88px;
        float: left;
        font-size: 14px;
        font-weight: bold;
    }

    .plan1 {
        background: url("/dist/img/plan1.png") no-repeat center center;
        background-size: 100%;
    }

    .plan2 {
        background: url("/dist/img/plan2.png") no-repeat center center;
        background-size: 100%;
    }

    .plan3 {
        background: url("/dist/img/plan3.png") no-repeat center center;
        background-size: 100%;
    }

    .boxItemTitleNotice {
        color: red;
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNotice i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 22px;
        width: 22px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .boxItemTitleNoticeTime {
        color: red;
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNoticeTime i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 16px;
        width: 16px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .search-button {
        width: 14px;
        height: 14px;
        background-image: url(/dist/img/glass.jpg);
        border: 0 none;
        cursor: pointer;
        margin-top: 0px;
    }

    input[type=button] {
        outline: none;
    }

    .oaBtn {
        background: url(/dist/img/btn-bj2.png) repeat-y !important;
        background-size: 100% 100% !important;
        color: #fff !important;
    }

    .btn-group-sm > .btn, .btn-sm {
        padding: 2px 10px;
    }

    .btn {
        border-radius: 3px;
        -webkit-box-shadow: none;
        box-shadow: none;
        border: 1px solid transparent;
    }

    .pull-right {
        float: right !important;
    }

    .blue {
        color: #39c;
    }

    .red {
        color: #e03800;
    }

    .weather img {
        height: 30px;
        width: 30px;
        float: left;
    }

    .btn-blue {
        border: none;
        background: #2a8cec;
        color: #fff;
        font-size: 16px;
        font-weight: bold;
        height: 48px;
        width: 100%;
        border-radius: 2px;
        outline: none;
        position: fixed;
        left: 0;
        bottom: 0;
    }

    .btn-blue:active {
        border: none;
        background: #356698;
        opacity: 0.8;
        color: #fff;
        font-size: 16px;
        height: 48px;
        width: 100%;
        border-radius: 2px;
        outline: none;
        /*position: fixed;*/
        left: 0;
        bottom: 0;
        font-weight: bold;
    }

    .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
        color: #fff;
        text-decoration: none;

    }

    .line {
        border-bottom: 4px solid #2a8cec;
    }

    .tdInput {
        color: #2a8cec;
        border: none;
        outline: none;
    }

    .icon-zhankai, .icon-shouqi {
        cursor: pointer;
        border-radius: 5px;
        float: right;
        font-weight: bold;
    }

    .model-picker-dropdown {
        position: absolute;
        width: 315px;
        left: -9999px;
        top: -9999px;
        outline: 0;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        z-index: 999999;
        display: none;
        min-width: 200px;
        margin-bottom: 20px;
        margin-top: 5px
    }

    .model-select-wrap {
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5)
    }

    .model-select-tab {
        border-bottom: 1px solid #ccc;
        background: #f5f5f5;
        font-size: 13px
    }

    .model-select-tab > a {
        display: inline-block;
        padding: 4px 20px;
        border-left: 1px solid #ccc;
        border-bottom: 1px solid transparent;
        color: #4D4D4D;
        text-align: center;
        outline: 0;
        text-decoration: none;
        cursor: pointer;
        font-size: 14px;
        margin-bottom: -1px
    }

    .model-select-tab > a.active {
        background: #fff;
        border-bottom: 1px solid #fff;
        color: #46A4FF
    }

    .model-select-tab > a:first-child {
        border-left: none
    }

    .model-select-tab > a:last-child.active {
        border-right: 1px solid #ccc
    }

    .model-select-content {
        width: 100%;
        min-height: 50px;
        background-color: #fff;
        padding: 5px 5px
    }

    .model-select {
        font-size: 16px
    }

    .model-select dl {
        line-height: 2;
        clear: both;
        padding: 3px 0;
        margin: 0;
        max-height: 200px;
        overflow-y: scroll
    }

    .model-select dt {
        position: absolute;
        width: 2.5em;
        font-weight: 500;
        text-align: right;
        line-height: 2
    }

    .model-select dd {
        margin-left: 0;
        line-height: 2
    }

    .model-select.province dd {
        margin-left: 3em
    }

    .model-select a {
        display: inline-block;
        padding: 0 10px;
        outline: 0;
        white-space: nowrap;
        margin-right: 2px;
        text-decoration: none;
        color: #333;
        cursor: pointer
    }

    .model-select a:hover, .model-select a:focus {
        background-color: #f1f8ff;
        border-radius: 2px;
        color: #46A4FF
    }

    .model-select a.active {
        background-color: #46A4FF;
        color: #fff;
        border-radius: 2px
    }

    .lineOne {
        max-height: 20px;
        line-height: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
    }

    .biTian {
        position: absolute;
        /*color: red;*/
        margin-left: -10px;
        margin-top: 3px;
    }

    .oaLoad {

    / / background: rgba(255, 255, 255, 0.8);
        z-index: 9997;
        display: none;
        width: 100%;
        height: 100%;
        position: fixed;
    }

    .loadGif {
        width: 200px;
        height: 118px;
        background-image: url(/dist/img/oaJiaZai.gif);
        background-size: cover;
        top: 50%;
        left: 50%;
        position: absolute;
        padding: 0px;
        margin: 0px;
        z-index: 100001;
        margin-left: -100px;
        margin-top: -56px;
    }
</style>
<body>
<div class="oaLoad">
    <div class="loadGif" id="areaProgress"></div>
</div>
<section class="content" id="app" style="padding-bottom: 48px;" v-cloak>

    <div class="div-td-content-more"><i></i></div>
    <div class="model-picker-dropdown">
        <div class="model-select-wrap">
            <div class="model-select-tab">
                <a class="active" data-count="type">省</a><a class="" data-count="brand">市</a><a data-count="model"
                                                                                                class="">县</a>
            </div>
            <div class="model-select-content">
                <div class="model-select type shen" data-count="type" style="display: block;">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in provinceList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select brand" data-count="province">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in cityList">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select model" data-count="model">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in countyList">{{item.name}}</a>
                    </dl>
                </div>
            </div>
        </div>
    </div>
    <div class="td-value1"
         style="padding: 10px 0px 10px 20px; margin-left: 0px;display: none;position: absolute;z-index:999; border: 1px solid #DEDEDE; !important;margin-left: 0px;background-color: white"
         id="selectModel">
        <div>
            <template v-if="pageType=='edit'">
                <div v-for="(item,i) in itemsDeviceType" style="overflow: hidden">
                    <div>{{item.name}}：</div>
                    <label v-for="(item2,index) in item.itemsMod" class="lable">
                        <input type="checkbox" value="item2.modelName" style="float: left"
                               :checked="checkedModelCustomerLists.indexOf(item2.modelName)>=0"
                               @click="checkedOne(item2.modelName)"/><span class="lineOne">{{item2.modelName}}</span>
                    </label>
                </div>
                <br>
            </template>
        </div>
        <div style="text-align: center">
            <input type="button" value="确定" class="btn oaBtn btn-xs"
                   @click="getIntentionModel()">
            <input type="button" value="取消" class="btn oaBtn btn-xs" style="margin-left: 12px;margin-top: 25px; "
                   @click="hiddenDivModel()">
        </div>
    </div>
    <div class="templateStyle">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background: #d3e8fd;color: black;">基本信息</td>
                    </tr>
                    <tr>
                        <td class="tdColor" style="width: 24%;"><i class="biTian"
                                                                   v-if="customerInfo.intentionFlag=='1'">*</i>姓名
                        </td>
                        <td style="width: 26%;text-align:left !important;">
                            <input v-if="pageType=='edit'" type="text" v-model="customerInfo.name"
                                   style="width: 100%;padding-left: 4px;" class="tdInput">
                            <span v-else class="lineOne" style="width: 100%;">{{customerInfo.name}}</span>
                        </td>
                        <td class="tdColor" style="width: 24%;"><i class="biTian"
                                                                   v-if="customerInfo.intentionFlag=='1'">*</i>电话
                        </td>
                        <td style="width: 26%;text-align:left !important;padding-left: 7px;">
                            <input class="tdInput" v-if="pageType=='edit'" type="tel"
                                   v-model="customerInfo.tel" style="width: 100%">
                            <span v-else style="width: 100%"> {{customerInfo.tel}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>类型</td>
                        <td style="text-align:left !important;">
                            <select id="customerType" v-if="pageType=='edit'"
                                    v-model="customerInfo.customerType"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option selected="selected">客户(个人)</option>
                                <option>客户(企业)</option>
                                <option>中介(个人)</option>
                                <option>中介(企业)</option>
                            </select>
                            <span v-else>{{customerInfo.customerType}}</span>
                        </td>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>信用</td>
                        <td style="text-align:left !important;">
                            <select id="customerCredit" v-if="pageType=='edit'"
                                    v-model="customerInfo.customerCredit"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option selected="selected">未知</option>
                                <option>合格</option>
                                <option>不合格</option>
                            </select>
                            <span v-else style="width: 100%"> {{customerInfo.customerCredit}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">生日</td>
                        <td style="text-align:left !important;">
                            <input class="tdInput" v-if="pageType=='edit'" type="text"
                                   placeholder=例:1993-05-18 v-model="customerInfo.birthday"
                                   style="width: 100%;padding-left: 4px;">
                            <span v-else style="width: 100%"> {{customerInfo.birthday}}</span>
                        </td>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>微信</td>
                        <td style="text-align:left !important;padding-left: 7px;">
                            <input class="tdInput" v-if="pageType=='edit'" type="text"
                                   v-model="customerInfo.wechat" style="width: 100% ">
                            <span v-else style="width: 100%"> {{trims(customerInfo.wechat)}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>来源</td>
                        <td style="text-align: left !important;">
                            <select id="source" v-if="pageType=='edit'"
                                    v-model="customerInfo.source"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option selected="selected">销售录入</option>
                                <option>易企秀</option>
                                <option>400</option>
                                <option>其他</option>
                            </select>
                            <span v-else> {{customerInfo.source}}</span>
                        </td>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>成交概率</td>
                        <td style="text-align: left !important;">
                            <select id="chance" v-if="pageType=='edit'"
                                    v-model="customerInfo.chance"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option selected="selected"><50%</option>
                                <option>50%</option>
                                <option>75%</option>
                                <option>100%</option>
                            </select>
                            <span v-else> {{customerInfo.chance}}</span>
                        </td>
                    </tr>

                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>是否意向客户</td>
                        <td v-if="pageType=='edit'" style="text-align: left;">
                                  <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput"
                                         type="radio" id="on"
                                         value="1" v-model="customerInfo.intentionFlag">
                                  <label for="on" style="width: 45%;">是</label>
                                  <input class="tdInput"
                                         type="radio" id="un"
                                         value="0" v-model="customerInfo.intentionFlag">
                                  <label for="un">否</label>
                              </span>
                        </td>
                        <td v-else style="text-align: left;">
                            {{customerInfo.intentionFlag=='1'?'是':'否'}}
                        </td>
                        <td class="tdColor"><i class="biTian">*</i>成交状态</td>
                        <td class="td-value" style="text-align:left !important;">
                            <select id="" v-if="pageType=='edit'"
                                    v-model="customerInfo.status" @change="c_status()"
                                    style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                                <option>跟踪中</option>
                                <option>已成交</option>
                                <option>丢单</option>
                            </select>
                            <span v-else>{{customerInfo.status}}</span>
                        </td>
                    </tr>

                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>地址</td>
                        <td v-if="pageType=='edit'" colspan="3" style="text-align: left;" class="selectModel">
                            <span type="text" style="width: 100%;padding-left: 4px;"
                                  v-if="customerInfo.provinceName!=''">{{customerInfo.provinceName}}-{{customerInfo.cityName}}-{{customerInfo.countyName}}</span>
                            <span v-else style="padding-left: 4px;">请选择</span>
                        </td>
                        <td v-else colspan="3" style="text-align: left;">
                            {{customerInfo.provinceName}}-{{customerInfo.cityName}}-{{customerInfo.countyName}}
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>对应区域</td>
                        <td class="td-value" colspan="3" style="text-align:left !important;">
                            <select v-model="customerInfo.regionId"
                                    style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;"
                                    @change="getGenZrByRegionId()">
                                <option v-for="(item,i) in regionList" :value="item.regionId">
                                    {{item.regionName}}
                                </option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian" v-if="customerInfo.intentionFlag=='1'">*</i>跟踪人</td>
                        <td class="td-value" colspan="3" style="text-align:left !important; padding-left: 8px;">
                            {{genZR}}
                        </td>
                    </tr>
                    <tr v-if="customerInfo.id">
                        <td class="tdColor">首次创建时间</td>
                        <td style="text-align:left !important;padding-left: 7px;">
                            <span style="width: 100%" v-if="customerInfo.createTime"> {{formatDate(customerInfo.createTime)}}</span>
                        </td>
                        <td class="tdColor">最新修改时间</td>
                        <td style="text-align:left !important;padding-left: 7px;">
                            <span style="width: 100%" v-if="customerInfo.updateTime"> {{formatDate(customerInfo.updateTime)}}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="templateStyle" v-if="customerInfo.intentionFlag=='1'">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background: #d3e8fd;color: black;">意向设备</td>
                    </tr>
                    <tr>
                        <td class="tdColor" style="width: 24%;"><i class="biTian">*</i>意向品牌</td>
                        <td style="text-align:left !important;" colspan="3">
                            <!--<input class="tdInput" v-if="pageType=='edit'" type="text"-->
                            <!--v-model="customerInfo.intentionBrand"-->
                            <!--style="width: 100%;padding-left: 4px;">-->


                            <select v-if="pageType=='edit'" id="testBran"
                                    v-model="customerInfo.intentionBrand"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;"
                                    @change="getModel">
                                <option value=""></option>
                                <option v-for="itemB in itemsBran" v-bind:value="itemB.brandName">
                                    {{itemB.brandName}}
                                </option>
                            </select>
                            <span v-else style="width: 100%"> {{customerInfo.intentionBrand}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian">*</i>意向机型</td>
                        <td style="text-align:left !important;" colspan="3">
                            <span @click="showDivModel($event)"
                                  style="width: 100%; padding-left: 4px;   height: 28px;line-height: 28px;display: block;"> {{customerInfo.intentionModel}}</span>

                            <!--<template v-if="pageType=='edit'">-->
                            <!--<label   v-for="(item2,index) in itemsMod">-->
                            <!--<input type="checkbox" value="item2.modelName"   :checked="checkedModelCustomerLists.indexOf(item2.modelName)>=0" @click="checkedOne(item2.modelName)"/>{{item2.modelName}}-->
                            <!--</label>-->
                            <!--</template>-->
                            <!--<select v-if="pageType=='edit'" id="testMod"
                                    v-model="customerInfo.intentionModel"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option value=""></option>
                                <option v-for="itemMo in itemsMod" v-bind:value="itemMo.modelName">
                                    {{itemMo.modelName}}
                                </option>
                            </select>-->
                        </td>

                    </tr>
                    <tr>
                        <td class="tdColor">限价(万)
                        </td>

                        <td style="text-align:left !important;" colspan="3">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   readonly="readonly"
                                   type="text" v-model="customerInfo.limitedPrice">
                            <span v-else style="display: block;text-align: center">{{customerInfo.limitedPrice}}</span>
                        </td>
                    </tr>
                    <tr>

                        <td class="tdColor" style=""><i class="biTian">*</i>购买方式</td>
                        <td class="td-value" style="text-align:left !important;" colspan="3">
                            <select id="buyType" v-if="pageType=='edit'"
                                    v-model="customerInfo.buyType"
                                    style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                                <option selected="selected">全款</option>
                                <option>内部分期</option>
                                <option>融资租赁</option>
                            </select>
                            <span v-else>{{customerInfo.buyType}}</span>
                        </td>

                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian">*</i>购买时间</td>
                        <td style="text-align:left !important;">
                            <select id="buyDate" v-if="pageType=='edit'"
                                    v-model="customerInfo.buyDate" @change="YJCJSJFunction()"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">

                                <option v-for="(item,index) in buyDateList" :value="item.key">
                                    {{item.value}}
                                </option>
                            </select>
                            <span v-else>{{customerInfo.buyDate}}</span>
                        </td>
                        <td class="tdColor" style="width: 24%;"
                        ><i class="biTian" style="margin-left: -8px"
                            v-if="customerInfo.buyDate=='todayMonth'||customerInfo.buyDate=='nextMonth'">*</i>预计成交时间
                        </td>
                        <td class="td-value" style="width: 26%;text-align:left !important;">
                            <select id=" " v-if="pageType=='edit'"
                                    v-model="customerInfo.yjOkDate"
                                    style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                                <option selected="selected"></option>
                                <option v-for="(item,index) in YJCJSJ">
                                    {{item}}
                                </option>

                            </select>
                            <span v-else>{{customerInfo.yjOkDate}}</span>
                        </td>
                    </tr>
                    <tr>

                        <td class="tdColor" style=""><i class="biTian"
                                                        v-if="customerInfo.intentionFlag=='1'">*</i>报价(万)
                        </td>
                        <!--<td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" type="text" v-model="customerInfo.quote"
                                   style="width: 100%;padding-left: 4px;" class="tdInput">
                            <span v-else class="lineOne" style="width: 100%;">{{customerInfo.quote}}</span>
                        </td>-->

                        <td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.quote"
                                   @blur="checkNum(customerInfo.quote,'quote')"/>
                            <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.quote)}}</span>
                        </td>

                        <td class="tdColor" style=""><i class="biTian" style="margin-left: -8px"
                                                        v-if="customerInfo.intentionFlag=='1'">*</i>心理价格(万)
                        </td>
                        <td style="text-align:left !important;">
                            <!-- <input class="tdInput" v-if="pageType=='edit'" type="text"
                                    v-model="customerInfo.psychologicalPrice" style="width: 100%">
                             <span v-else style="width: 100%"> {{customerInfo.psychologicalPrice}}</span>-->
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.psychologicalPrice"
                                   @blur="checkNum(customerInfo.psychologicalPrice,'psychologicalPrice')"/>
                            <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.psychologicalPrice)}}</span>
                        </td>
                    </tr>
                    <tr>


                        <td class="tdColor" style=""><i class="biTian"
                        ></i>首付比例
                        </td>
                        <td style="text-align:left !important;position: relative;" colspan="3">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="text" v-model="customerInfo.paymentRatio"/>
                            <span v-else style="display: block;text-align: center">{{customerInfo.paymentRatio}}</span>
                            <span style="position: absolute;left: 35px;top: 5px;">%</span>
                        </td>
                    </tr>
                    <tr>

                        <td class="tdColor" style="">定金状态
                        </td>

                        <td class="td-value" style="text-align:left !important;">
                            <select v-if="pageType=='edit'"
                                    v-model="customerInfo.earnestStatus"
                                    style="background-color: white;color: #2a8cec;border-style:none;width:100%;outline: none;">
                                <option value="未交">未交</option>
                                <option value="已交">已交</option>

                            </select>
                            <span v-else>{{customerInfo.earnestStatus}}</span>
                        </td>

                        <td class="tdColor" style=""><i class="biTian"
                        ></i>定金金额(万)
                        </td>
                        <td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.earnestMoney"
                                   @blur="checkNum(customerInfo.earnestMoney,'earnestMoney')"/>
                            <span v-else
                                  style="display: block;text-align: center">{{fmoney(customerInfo.earnestMoney)}}</span>
                        </td>
                    </tr>
                    <tr>

                        <td class="tdColor" style=""><i class="biTian"
                        ></i>首付预计收款日期
                        </td>

                        <td style="text-align:left !important;">
                            <!--<input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"-->
                            <!--type="text" @blur="strFormat($event.target,'customerInfo.paymentDate')"-->
                            <!--@focus="strFormatF($event.target,'customerInfo.paymentDate')"-->
                            <!--v-onedate="fmoney(customerInfo.paymentDate)"/>-->
                            <!--<span v-else style="display: block;text-align: center">{{customerInfo.paymentDate}}</span>-->

                            <input class="tdInput" @focus="showDatePicker($event)"
                                   v-model="customerInfo.paymentDate" v-if="pageType=='edit'"
                                   style="width: 100%;border: 0px" type="text"
                            />
                            <span v-else class="pull-left "
                                  style="margin-left: 10px;">{{customerInfo.paymentDate}}</span>
                        </td>

                        <td class="tdColor" style=""><i class="biTian"
                        ></i>收款金额(万)
                        </td>
                        <td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.amountCollect"
                                   @blur="checkNum(customerInfo.amountCollect,'amountCollect')"/>
                            <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.amountCollect)}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor"><i class="biTian">*</i>是否置换</td>
                        <td v-if="pageType=='edit'" style="text-align: left;">
                                  <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput"
                                         type="radio" id="on1"
                                         value="1" v-model="customerInfo.ifReplace">
                                  <label for="on1" style="width: 24px;">是</label>
                                  <input class="tdInput" style="margin-left: 3px"
                                         type="radio" id="un1"
                                         value="0" v-model="customerInfo.ifReplace">
                                  <label for="un1">否</label>
                              </span>
                        </td>
                        <td v-else style="text-align: left;">
                            {{customerInfo.ifReplace=='1'?'是':'否'}}
                        </td>
                        <td style="" colspan="2" v-if="customerInfo.ifReplace=='0'"></td>
                        <td class="tdColor" style="" v-if="customerInfo.ifReplace=='1'"><i class="biTian"
                                                                                           v-if="customerInfo.ifReplace=='1'">*</i>置换品牌机型
                        </td>
                        <td style="text-align:left !important;" v-if="customerInfo.ifReplace=='1'">
                            <input v-if="pageType=='edit'" class="tdInput" style="width: 100%;padding-left: 4px;"
                                   type="text" v-model="customerInfo.replaceType"/>
                            <span v-else style="display: block;text-align: center">{{customerInfo.replaceType}}</span>
                        </td>
                    </tr>
                    <tr v-if="customerInfo.ifReplace=='1'">

                        <td class="tdColor" style=""><i class="biTian"
                                                        v-if="customerInfo.ifReplace=='1'">*</i>评估价(万)
                        </td>

                        <td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" class="tdInput replaceInput"
                                   style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.valuationPrice"
                                   @blur="checkNum(customerInfo.valuationPrice,'valuationPrice')"/>
                            <span v-else style="display: block;text-align: center">{{fmoney(customerInfo.valuationPrice)}}</span>

                        </td>

                        <td class="tdColor" style=""><i class="biTian"
                                                        v-if="customerInfo.ifReplace=='1'">*</i>客户要价(万)
                        </td>
                        <td style="text-align:left !important;">
                            <input v-if="pageType=='edit'" class="tdInput replaceInput"
                                   style="width: 100%;padding-left: 4px;"
                                   type="number" v-model="customerInfo.customerAsk"
                                   @blur="checkNum(customerInfo.customerAsk,'customerAsk')"/>
                            <span v-else
                                  style="display: block;text-align: center">{{fmoney(customerInfo.customerAsk)}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tdColor">设备用途</td>
                        <td clsss="td-value" colspan="3" v-if="pageType=='edit'"
                            style="text-align: left;background-color: white">
                             <span v-if="currentFlag" style="display: flex;align-items: center;">
                                  <input class="tdInput" id="self"
                                         type="radio"
                                         value="1" v-model="customerInfo.deviceUse">
                                  <label for="self" style="width: 24px;">自用</label>
                                  <input class="tdInput" id="unself" style="margin-left: 3px"
                                         type="radio"
                                         value="0" v-model="customerInfo.deviceUse">
                                  <label for="unself">非自用</label>
                              </span>
                            <span v-else class="pull-left" style="margin-left: 18.5%">{{flag.value=='1'?'是':'否'}}</span>
                            <!--<select id="deviceUse" v-if="pageType=='edit'"
                                    v-model="customerInfo.deviceUse"
                                    style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                <option value=""></option>
                                <option value="1">自用</option>
                                <option value="0">非自用</option>
                            </select>
                            <span v-else>{{customerInfo.deviceUse}}</span>-->
                        </td>
                        <td v-else clsss="td-value" colspan="3" style="text-align: left">
                            {{customerInfo.deviceUse==0 ? '非自用':'自用'}}
                        </td>
                    </tr>
                    <tr>
                        <template v-if="pageType=='edit'">
                            <td class="tdColor"
                                v-if="customerInfo.intentionFlag==1">
                                <i class="biTian">*</i>现有设备
                            </td>
                            <td class="tdColor" v-else>现有设备</td>
                        </template>
                        <template v-else>
                            <td class="tdColor">现有设备</td>
                        </template>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.existingDevice"
                                      placeholder="请填写客户现有设备及使用情况"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.existingDevice}}</span>
                        </td>
                    </tr>
                    <tr>
                        <template v-if="pageType=='edit'">
                            <td class="tdColor"
                                v-if="customerInfo.intentionFlag==1">
                                <i class="biTian">*</i>从业经验
                            </td>
                            <td class="tdColor" v-else>从业经验</td>
                        </template>
                        <template v-else>
                            <td class="tdColor">从业经验</td>
                        </template>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.workingExperience"
                                      placeholder="请填写客户以前和现在从事过的行业及相关经验"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.workingExperience}}</span>
                        </td>
                    </tr>
                    <tr>
                        <template v-if="pageType=='edit'">
                            <td class="tdColor"
                                v-if="customerInfo.intentionFlag==1">
                                <i class="biTian">*</i>工程情况
                            </td>
                            <td class="tdColor" v-else>工程情况</td>
                        </template>
                        <template v-else>
                            <td class="tdColor">工程情况</td>
                        </template>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.buildCondition"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.buildCondition}}</span>
                        </td>
                    </tr>
                    <tr>
                        <template v-if="pageType=='edit'">
                            <td class="tdColor"
                                v-if="customerInfo.intentionFlag==1">
                                <i class="biTian">*</i>收入预测
                            </td>
                            <td class="tdColor" v-else>收入预测</td>
                        </template>
                        <template v-else>
                            <td class="tdColor">收入预测</td>
                        </template>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.revenueForecast"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.revenueForecast}}</span>
                        </td>
                    </tr>
                    <tr>
                        <template v-if="pageType=='edit'">
                            <td class="tdColor"
                                v-if="customerInfo.intentionFlag==1">
                                <i class="biTian">*</i>竞争对手
                            </td>
                            <td class="tdColor" v-else>竞争对手</td>
                        </template>
                        <template v-else>
                            <td class="tdColor">竞争对手</td>
                        </template>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'"
                                      placeholder="请填写竞争对手的商务条件" type="text"
                                      v-model="customerInfo.competitorCondition"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.competitorCondition}}</span>
                        </td>
                    </tr>
                    <tr v-if="isAdd!=1">
                        <td class="tdColor">拜访内容</td>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.otherCondition"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.otherCondition}}</span>
                        </td>
                    </tr>
                    <!-- <tr>
                         <td class="tdColor">跟踪结果</td>
                         <td clsss="td-value" colspan="3"
                             style="text-align: left;background-color: white">
                             <select id="throwFlag" v-if="pageType=='edit'"
                                     v-model="customerInfo.throwFlag"
                                     style=" background-color: white;width:100%;color: #2a8cec;border-style:none;outline: none;">
                                 <option value="0">不成交</option>
                                 <option value="1">丢单</option>
                                 <option value="2">成交</option>
                             </select>
                             <span v-else>{{customerInfo.throwFlag}}</span>
                         </td>
                     </tr>-->
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="templateStyle" v-if="customerInfo.status=='丢单'">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background: #d3e8fd;color: black;">丢单详情</td>
                    </tr>
                    <tr>
                        <td class="tdColor" style=""><i class="biTian">*</i>丢单原因</td>
                        <td colspan="3" class="lineTwo">
                            <textarea class="tdInput" v-if="pageType=='edit'" type="text"
                                      v-model="customerInfo.throwReason"
                                      style="width: 100%;height: 55px;resize: none;padding-left: 4px;">
                            </textarea>
                            <span v-else
                                  style="width: 100%;padding: 0px;height: 55px;"> {{customerInfo.throwReason}}</span>
                        </td>
                    </tr>
                    <tr></tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="templateStyle" v-if="customerVisitList && customerVisitList.length>0">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background: #d3e8fd;color: black;">
                            <span style="margin-left: 16px;">跟踪历史</span>
                            <span class="iconfont icon-zhankai"
                                  v-if="btns==0 && customerVisitList.length>1"
                                  @click="btns=1"></span>
                            <span class="iconfont icon-shouqi"
                                  v-if="btns==1&& customerVisitList.length>1"
                                  @click="btns=0"></span>
                        </td>
                    </tr>
                    <template v-if="btns==0">
                        <template v-for="(item,i) in customerVisitList" v-if="i<3">
                            <tr>
                                <td class="tdColor"
                                    style="border-bottom: 4px solid #2c8cec;width: 24%">拜访时间
                                </td>
                                <td style="text-align: left;padding-left: 8px;width: 26%">
                                    {{formatDate(item.createTime)}}
                                </td>
                                <td class="tdColor" style="width: 24%">拜访方式</td>
                                <td style="text-align: left;width: 26%">
                                    <span v-if="item.visitModel==='0'">电访</span>
                                    <span v-else-if="item.visitModel==='1'">面访</span>
                                    <span v-else></span>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdColor">拜访人员</td>
                                <td colspan="3" style="text-align: left;padding-left: 8px;">
                                    {{item.createUserName}}
                                </td>
                            </tr>
                            <tr>
                                <td class="tdColor">拜访内容</td>
                                <td colspan="3" class="lineTwo">
                                    <span style="height: 55px;">{{item.otherCondition}}</span>
                                </td>
                            </tr>
                        </template>
                    </template>
                    <template v-else>
                        <template v-for="(item,i) in customerVisitList">
                            <tr>
                                <td class="tdColor"
                                    style="border-bottom: 4px solid #2c8cec;width: 24%">拜访时间
                                </td>
                                <td style="text-align: left;padding-left: 8px;width: 26%">
                                    {{formatDate(item.createTime)}}
                                </td>
                                <td class="tdColor" style="width: 24%">拜访方式</td>
                                <td style="text-align: left;width: 26%">
                                    <span v-if="item.visitModel==='0'">电访</span>
                                    <span v-else-if="item.visitModel==='1'">面访</span>
                                    <span v-else></span>
                                </td>
                            </tr>
                            <tr>
                                <td class="tdColor">拜访人员</td>
                                <td colspan="3" style="text-align: left;padding-left: 8px;">
                                    {{item.createUserName}}
                                </td>
                            </tr>
                            <tr>
                                <td class="tdColor">拜访内容</td>
                                <td colspan="3" class="lineTwo">
                                    <span style="height: 55px;">{{item.otherCondition}}</span>
                                </td>
                            </tr>
                        </template>
                    </template>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <!--<div style="height: 48px;"></div>-->
    <button type="button" class="btn btn-blue" style="display: flex;justify-content: center"
            @click="save()" v-if="(pageType!='look'&&isAdd=='1')||(pageType=='edit'&&editBtn)">保存
    </button>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {

        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName = $(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content" + " ." + boxName).show();
        });
        $("body").on("click", ".model-select  a", function (e) {
//            if ($(this).hasClass("active")) {
//                return false;
//            }
            $(this).parent().find("a").removeClass("active");
            var id = $(this).attr("attr-id");
            $(this).addClass("active");
            var val = $(this).text();
            if ($(this).parents(".model-select").hasClass("type")) {
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                $(".xianValue").attr("data-shen", val);
                app.customerInfo.provinceName = val
                app.getCity(id);
                $(".model-select-content .brand").show();

            } else if ($(this).parents(".model-select").hasClass("brand")) {
                $(".model-select-tab a").removeClass("active");
                var id = $(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                $(".xianValue").attr("data-shi", val);
                app.getCounty(id);
                $(".model-select-content .model").show();
                app.customerInfo.cityName = val
            } else {
                $(".xianValue").attr("data-xian", val);
                $(".xianValue").val($(".xianValue").attr("data-shen") + "-" + $(".xianValue").attr("data-shi") + "-" + $(".xianValue").attr("data-xian"));
                app.customerInfo.countyName = val
                app.customerInfo.regionId = '';
                app.genZR = '';
                app.getRegionByAddress("1");

                console.log(val)
                $(".model-picker-dropdown").hide();
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": "100px",
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    Vue.directive('onedate', {
        // 当被绑定的元素插入到 DOM 中时……
        update: function (el, binding) {
            // 聚焦元素
            if (app.pageType != 'add') {
                if (el.value == "NaN.undefined" || el.value == "") {
                    if (binding.value == 0 || binding.value == 0.00) {
                        el.value = 0
                    } else {
                        el.value = binding.value
                    }

                }
            }
        },
        componentUpdated: function (el, binding) {
            // 聚焦元素
        }
    })
    var app = new Vue({
        el: "#app",
        data: {
            currentFlag: '0',
            userId: getUrlParamObj().userId,
            companyId: getUrlParamObj().companyId,
            type: getUrlParamObj().type,
            index: getUrlParamObj().index,
            list: [],
            customerId: getUrlParamObj().customerId,
            isAdd: getUrlParamObj().isAdd,
            newPager: getUrlParamObj().newPager,
            yuce: "0",
            regionList: [],
            genZR: '',
            provinceList: [],
            cityList: [],
            userInfo: {},
            countyList: [],
            pageType: 'edit',
            selectBran: "请选择品牌",
            selectMod: "请选择型号",
            itemsBran: [],
            itemsDeviceType: [],
            buyDateObj: {},
            buyDateList: [],
            intent: [
                {text: '是', value: '1'},
                {text: '否', value: '0'},
            ],
            today: new Date(),
            customerInfo: {
                id: "",
                name: "",
                tel: "",
                birthday: "",
                buildCondition: "",
                buyDate: "",
                buyType: "",
                cityName: "",
                competitorCondition: "",
                countyName: "",
                customerCredit: "",
                customerType: "",
                deviceUse: "",
                existingDevice: "",
                intentionBrand: "",
                intentionModel: "",
                provinceName: "",
                revenueForecast: "",
                source: "销售录入",
                chance: "",
                wechat: "",
                otherCondition: "",
                workingExperience: "",
                createUserId: '',
                throwFlag: '',
                yuJChJRQ: '', //预计成交日期
                status: '', //成交状态
                throwReason: '', //丢单原因
                limitedPrice: "",
                paymentRatio: "",
                earnestStatus: "",
                earnestMoney: "",
                paymentDate: "",
                amountCollect: "",
                ifReplace: "",
                replaceType: "",
                valuationPrice: "",
                customerAsk: ""
            },
            oldCustomerInfo: {},
            customerInfoNewList: {
                id: "",
                name: "",
                tel: "",
                birthday: "",
                buildCondition: "",
                buyDate: "",
                buyType: "",
                cityName: "",
                competitorCondition: "",
                countyName: "",
                customerCredit: "",
                customerType: "",
                deviceUse: "",
                existingDevice: "",
                intentionBrand: "",
                intentionModel: "",
                provinceName: "",
                revenueForecast: "",
                source: "销售录入",
                chance: "",
                wechat: "",
                otherCondition: "",
                workingExperience: "",
                createUserId: '',
                throwFlag: '',
                yuJChJRQ: '', //预计成交日期
                status: '', //成交状态
                throwReason: '', //丢单原因
                limitedPrice: "",
                paymentRatio: "",
                earnestStatus: "",
                earnestMoney: "",
                paymentDate: "",
                amountCollect: "",
                ifReplace: "",
                replaceType: "",
                valuationPrice: "",
                customerAsk: ""
            },
            checkedModelCustomerLists: [],
            customerVisitList: [],
            YJCJSJ: [],
            customerVisitToday: {
                id: '',
                customerId: '',
                createTime: '',
                visitModel: '',
                createUserId: getUrlParamObj().userId,
                otherCondition: ''
            },
            btns: 0,
            isRegion: getUrlParamObj().isRegion,
            isSelf: getUrlParamObj().isSelf,
            editBtn: false

        },
        methods: {
            formatDate: function (now) {
//                return  NewDate(now).Format(TimeFormat.pcList)
                return new Date(now).Format(TimeFormat.middle)
            },
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.customerInfo.paymentDate = dp.cal.getNewDateStr();
                        return true;
                    },
                });
                $(e.target).blur();
            },
            //去空格
            trims: function (data) {
                if (data) {
                    var data = data.replace(/[ ]/g, "");
                }
                return data;
            },
            showDivModel: function (event) {
                $("#selectModel").css({
                    "left": "100px",
                    "top": (event.pageY) + "px"
                }).show();
            },
            hiddenDivModel: function () {
                $("#selectModel").hide();
            },
            getIntentionModel: function () {
                if (this.checkedModelCustomerLists.length > 0) {
                    var checkedModelCustomerString = "";
                    for (var j = 0; j < this.checkedModelCustomerLists.length; j++) {
                        if (this.checkedModelCustomerLists[j] != "") {
                            checkedModelCustomerString += this.checkedModelCustomerLists[j] + "、";
                        }
                    }
                    this.customerInfo.intentionModel = checkedModelCustomerString.substring(0, checkedModelCustomerString.length - 1);

                } else {
                    this.customerInfo.intentionModel = ""
                }
                this.hiddenDivModel();
                this.getLimitedPrice(this.customerInfo.intentionModel);

            },
            getRegionByAddress: function (type) {
                var that = this;
               var createUserId="";
                if (that.customerInfo.createUserId){
                    createUserId=that.customerInfo.createUserId
                } else{
                    createUserId=that.userId
                }
                var data={
                    'provinceName': that.customerInfo.provinceName,
                    'cityName': that.customerInfo.cityName,
                    'countyName': that.customerInfo.countyName,
                    'createUserId' :createUserId
                }
                $.wyui.postMethod("/intentionCustomerManagement/getRegionByAddress.json", data, function (r) {
                    that.regionList = r;
                    if (r && r.length > 0 && type && type == '1') {
                        that.customerInfo.regionId = r[0].regionId
                        that.getGenZrByRegionId();
                    }
                })
            },
            getGenZrByRegionId: function () {
                var that = this;
                $.wyui.postMethod("/intentionCustomerManagement/getGenZrByRegionId.json", {'regionId': that.customerInfo.regionId}, function (r) {
                    if (r){
                        that.genZR = r.genZR;
                    }

                })
            },
            getLimitedPrice: function (intentionModel) {
                var that = this;
                $.wyui.postMethod("/intentionCustomerManagement/getLimitedPrice.json", {'intentionModel': intentionModel}, function (r) {
                    that.customerInfo.limitedPrice = r.string;
                })

            },
            // 电话号码中间用*代替
            telNumber: function (telNum) {
                var firstTelNum = telNum.substring(0, 3);
                var lastTelNum = telNum.substring(telNum.length - 4, telNum.length);
                return firstTelNum + "****" + lastTelNum;
            },
            showToast: function (title) {

                var param = {
                    title: title
                }
                JSBridge.call(UI, 'showToast', param)
            },
            showProcess: function () {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    $(".oaLoad").show();
                } else {
                    if (that.newPager == '1') {
                        JSBridge.call(UI, 'showLoading', {})
                    } else {
                        var obj = {
                            dialog: 'show'
                        };
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            showSave: function (type) {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    that.showModel(200, type)
                } else {
                    alert(type)
                }
            },
            hideProcess: function () {
                var that = this;
                if (that.type == 'pc' || that.type == 'pcList' || that.type == 'pcbb') {
                    $(".oaLoad").hide();
                } else {
                    if (that.newPager == '1') {
                        JSBridge.call(UI, 'hideLoading')
                    } else {
                        var obj = {
                            dialog: 'hidden'
                        };
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            strFormat: function (target, data) {
                //此结果为了展示数据
                var value = (target.value).trim();
                value = value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g, '');
                if (!value) {
                    value = 0
                }
                ;
                //此结果为data存入数据
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        this[dataList[0]] = value;
                    }
                    if (dataList.length == 2) {
                        this[dataList[0]][dataList[1]] = value;
                    }
                    if (dataList.length == 3) {
                        this[dataList[0]][dataList[1]][dataList[2]] = value;
                    }
                    if (dataList.length == 4) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]] = value;
                    }
                    if (dataList.length == 5) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]] = value;
                    }
                }
                target.value = this.fmoney(value);
                if (target.value == '0.00') {
                    target.value = 0
                }
            },
            strFormatF: function (target, data) {
                var value = '';
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        value = this[dataList[0]]
                    }
                    if (dataList.length == 2) {
                        value = this[dataList[0]][dataList[1]]
                    }
                    if (dataList.length == 3) {
                        value = this[dataList[0]][dataList[1]][dataList[2]]
                    }
                    if (dataList.length == 4) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]]
                    }
                    if (dataList.length == 5) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]]
                    }
                }
                if (!value || value == '0.00') {
                    console.log('获取焦点', value)
                    value = '';
                }
                target.value = value;
            },
            c_status: function () {
                var that = this;
                if (that.customerInfo.status == '丢单' || that.customerInfo.status == '已成交') {
                    that.customerInfo.intentionFlag = 0;
                }
            },
            YJCJSJFunction: function () {
                var that = this;
                that.YJCJSJ = [];
                var buyDate = that.customerInfo.buyDate;
                var dateTime = new Date().Format("yyyy-MM-dd");
                var today = parseInt(dateTime.substring(8, 10));
                var month = parseInt(dateTime.substring(5, 7));
                //本月内 下月内
                if (buyDate == 'todayMonth' || buyDate == 'nextMonth') {
                    if (buyDate == 'todayMonth') {
                        if (Number(today) < 11) {
                            var nextMonth = parseInt(Number(month) + 1);
                            that.YJCJSJ.push(month + '月上旬');
                            that.YJCJSJ.push(month + '月中旬');
                            that.YJCJSJ.push(month + '月下旬');
                        } else if (Number(today) < 21) {
                            var nextMonth = parseInt(Number(month) + 1);
                            that.YJCJSJ.push(month + '月中旬');
                            that.YJCJSJ.push(month + '月下旬');
                        } else {
                            var nextMonth = parseInt(Number(month) + 1);
                            that.YJCJSJ.push(month + '月下旬');
                        }
                    } else {
                        if (Number(today) < 11) {
                            var nextMonth = parseInt(Number(month) + 1);

                            that.YJCJSJ.push(nextMonth + '月上旬');
                            that.YJCJSJ.push(nextMonth + '月中旬');
                            that.YJCJSJ.push(nextMonth + '月下旬');
                        } else if (Number(today) < 21) {
                            var nextMonth = parseInt(Number(month) + 1);

                            that.YJCJSJ.push(nextMonth + '月上旬');
                            that.YJCJSJ.push(nextMonth + '月中旬');
                            that.YJCJSJ.push(nextMonth + '月下旬');
                        } else {
                            var nextMonth = parseInt(Number(month) + 1);

                            that.YJCJSJ.push(nextMonth + '月上旬');
                            that.YJCJSJ.push(nextMonth + '月中旬');
                            that.YJCJSJ.push(nextMonth + '月下旬');
                        }
                    }
                } else {
                    that.customerInfo.yjOkDate = '';
                    that.YJCJSJ = [];
                }
            },
            //判断是否为小数或数字
            checkNum: function (num, type, dil) {
                var that = this;
                that.newPager = getUrlParamObj().newPager;
                var re = /^\d+(?=\.{0,1}\d+$|$)/;
                //如果带小数点，判断小数点前边的位数
                console.log(num, dil);
                num = num + "";
                if (num != "") {
                    //判断格式是数字
                    if (!re.test(num)) {
                        if (dil != '1') {
                            if (that.newPager == '1') {
                                that.showToast("输入格式不正确")
                            } else {
                                alert("输入格式不正确");
                            }
                            that.customerInfo[type] = "";
                        }
                        return false;
                    }
                    //判断金额过大
                    if (Number(num) > 999) {
                        if (dil != '1') {
                            if (that.newPager == '1') {
                                that.showToast("金额不能超过百万")
                            } else {
                                alert("金额不能超过百万");
                            }
                            that.customerInfo[type] = "";
                        }
                        return false;
                    }
                    return true
                }else {
                    return true
                }
            },
            clone: function (obj) {
                var str, newobj = obj.constructor === Array ? [] : {};
                if (typeof obj !== 'object') {
                    return;
                } else if (window.JSON) {
                    str = JSON.stringify(obj), //序列化对象
                        newobj = JSON.parse(str); //还原
                } else {
                    for (var i in obj) {
                        newobj[i] = typeof obj[i] === 'object' ? cloneObj(obj[i]) : obj[i];
                    }
                }
                return newobj;
            },
            getCustomerInfoById: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getCustomerInfoById, {
                    "customerId": that.customerId,
                    "userId": that.userId
                }, function (data) {
                    that.hideProcess();
                    data.customerInfo.otherCondition = "";
                    that.customerInfo = data.customerInfo;
                    that.oldCustomerInfo = that.clone(data.customerInfo);
                    that.YJCJSJFunction();
                    if (that.customerInfo) {
                        if (that.userInfo.roleName == '大区经理' || that.userInfo.roleName == '区域经理' || that.userInfo.roleName == '区域总监' || that.userInfo.roleName == '区域组长') {
                            that.pageType = 'edit'
                        } else {
                            // that.pageType = 'look'
                        }
                        if (that.isSelf == '0') {
                            that.pageType = 'look'
                        }
                        if (that.pageType == 'look') {
                            that.customerInfo.tel = that.telNumber(that.customerInfo.tel);
                            that.customerInfo.wechat = '******'
                        }
                    }

                    that.customerVisitList = data.customerVisitList;
                    if (data.customerVisitToday != 'null') {
                        that.customerVisitToday = data.customerVisitToday
                    }

                    if (data.customerInfo.intentionModel) {
                        console.log(data.customerInfo.intentionModel.split("、"))
                        that.checkedModelCustomerLists = data.customerInfo.intentionModel.split("、");
                    } else {
                        that.checkedModelCustomerLists = [];
                    }
                    that.getLimitedPrice(data.customerInfo.intentionModel);


                    /*if (that.customerInfo.intentionBrand != "") {
                     that.getModel();
                     }*/
                    // if (that.pageType == 'edit') {
                    //     that.customerVisitToday.otherCondition = ''
                    // }

                }, true);
            },
            //日期格式限制
            isDate: function (val) {
                var pattern = /^((19[2-9]\d{1})|(20((0[0-9])|(1[0-8]))))\-((0?[1-9])|(1[0-2]))\-((0?[1-9])|([1-2][0-9])|30|31)$/;
                if (pattern.test(val)) {
                    var date = new Date(val);
                    var month = val.substring(val.indexOf("-") + 1, val.lastIndexOf("-"));
                    return date && (date.getMonth() + 1 == parseInt(month));
                }
                return false;
            },

            checkedOne: function (moduleKey) {
                var idIndex = this.checkedModelCustomerLists.indexOf(moduleKey)
                if (idIndex >= 0) {
                    this.checkedModelCustomerLists.splice(idIndex, 1)
                } else {
                    this.checkedModelCustomerLists.push(moduleKey)
                }

                console.log(this.checkedModelCustomerLists);
            },
            fmoney: function (s, n) {
                if (!s) {
                    s = 0;
                }
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            save: function () {
                var that = this;
                delete that.customerInfo.createTime;
                delete that.customerInfo.updateTime;
                if (that.customerInfo.status == '丢单' || that.customerInfo.status == '已成交') {
                    that.customerInfo.intentionFlag = "0"
                }
                if (that.customerInfo.status == '') {
                    if (that.newPager == '1') {
                        that.showToast("请输入成交状态")
                    } else {
                        alert("请输入成交状态");
                    }
                    return false;
                }
                if (that.customerInfo.status == '丢单' && that.customerInfo.throwReason == '') {
                    if (that.newPager == '1') {
                        that.showToast("请输入丢单原因")
                    } else {
                        alert("请输入丢单原因");
                    }
                    return false;
                }
                if (that.customerInfo.intentionFlag != "0") {
                    if (that.customerInfo.name == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户姓名")
                        } else {
                            alert("请输入客户姓名");
                        }
                        return false;
                    }

                    if (that.customerInfo.tel == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入客户手机号码")
                        } else {
                            alert("请输入客户手机号码");
                        }
                        return false;
                    }

                    if (that.customerInfo.tel.length != 11) {
                        if (that.newPager == '1') {
                            that.showToast("手机号格式不正确")
                        } else {
                            alert("手机号格式不正确");
                        }
                        return false;
                    }
                    if (that.customerInfo.customerType == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户类型不能为空")
                        } else {
                            alert("客户类型不能为空");
                        }
                        return false;
                    }
                    if (that.customerInfo.customerCredit == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户信用不能为空")
                        } else {
                            alert("客户信用不能为空");
                        }
                        return false;
                    }
                    if (that.customerInfo.wechat == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户微信不能为空")
                        } else {
                            alert("客户微信不能为空");
                        }
                        return false;
                    }
                    if (!that.isDate(that.customerInfo.birthday) && that.customerInfo.birthday != "") {
                        if (that.newPager == '1') {
                            that.showToast("生日格式不正确，例如1998-01-01")
                        } else {
                            alert("生日格式不正确，例如1998-01-01");
                        }
                        return false;
                    }
                    if (that.customerInfo.source == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户来源不能为空")
                        } else {
                            alert("客户来源不能为空");
                        }
                        return false;
                    }


                    if (that.customerInfo.chance == "") {
                        if (that.newPager == '1') {
                            that.showToast("请选择成交概率")
                        } else {
                            alert("请选择成交概率");
                        }
                        return false;
                    }

                    if (that.customerInfo.countyName == "") {
                        if (that.newPager == '1') {
                            that.showToast("客户地址不能为空，且必须精确到县！")
                        } else {
                            alert("客户地址不能为空，且必须精确到县！");
                        }
                        return false;
                    }
                    if (that.customerInfo.regionId == "") {
                        if (that.newPager == '1') {
                            that.showToast("对应区域不能为空！")
                        } else {
                            alert("对应区域不能为空！");
                        }
                        return false;
                    }
                    if (that.customerInfo.intentionBrand == "") {
                        if (that.newPager == '1') {
                            that.showToast("请选择意向品牌")
                        } else {
                            alert("请选择意向品牌");
                        }
                        return false;
                    }

                    if (that.customerInfo.intentionModel == "") {
                        if (that.newPager == '1') {
                            that.showToast("请选择意向机型")
                        } else {
                            alert("请选择意向机型");
                        }
                        return false;
                    }

                    if (that.customerInfo.buyType == '') {
                        if (that.newPager == '1') {
                            that.showToast("请选择购买方式")
                        } else {
                            alert("请选择购买方式");
                        }
                        return false;
                    }
                    if (that.customerInfo.buyDate == "") {
                        if (that.newPager == '1') {
                            that.showToast("请选择客户购买时间")
                        } else {
                            alert("请选择客户购买时间");
                        }
                        return false;
                    }
                    if (that.customerInfo.buyDate == 'todayMonth' || that.customerInfo.buyDate == 'nextMonth') {
                        if (that.customerInfo.yjOkDate == '' || that.YJCJSJ.indexOf(that.customerInfo.yjOkDate) == -1) {
                            if (that.newPager == '1') {
                                that.showToast("请选择客户预计成交时间")
                            } else {
                                alert("请选择客户预计成交时间");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.quote == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入正确的客户报价")
                        } else {
                            alert("请输入正确的客户报价");
                        }
                        return false;
                    } else {
                        if (that.checkNum(that.customerInfo.quote, "quote", "1") == false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的客户报价")
                            } else {
                                alert("请输入客户报价");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.psychologicalPrice == "") {
                        if (that.newPager == '1') {
                            that.showToast("请输入正确的客户心理价格")
                        } else {
                            alert("请输入正确的客户心理价格");
                        }
                        return false;
                    } else {
                        console.log(that.checkNum(that.customerInfo.psychologicalPrice, "psychologicalPrice", "1"))
                        if (that.checkNum(that.customerInfo.psychologicalPrice, "psychologicalPrice", "1") == false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的客户心理价格")
                            } else {
                                alert("请输入客户心理价格");
                            }
                            return false;
                        }
                    }
                    if (that.customerInfo.ifReplace === '') {
                        if (that.newPager == '1') {
                            that.showToast("请选择是否置换")
                        } else {
                            alert("请选择是否置换");
                        }
                        return false;
                    }
                    //选择置换后必填
                    if (that.customerInfo.ifReplace == '1') {
                        if (that.customerInfo.replaceType == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写置换品牌机型")
                            } else {
                                alert("请填写置换品牌机型");
                            }
                            return false;
                        }
                        if (that.customerInfo.valuationPrice == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写评估价")
                            } else {
                                alert("请填写评估价");
                            }
                            return false;
                        } else {
                            if (that.checkNum(that.customerInfo.valuationPrice, "valuationPrice", "1") == false) {
                                if (that.newPager == '1') {
                                    that.showToast("请输入正确的评估价")
                                } else {
                                    alert("请输入正确的评估价");
                                }
                                return false;
                            }
                        }
                        if (that.customerInfo.customerAsk == "") {
                            if (that.newPager == '1') {
                                that.showToast("请填写客户要价")
                            } else {
                                alert("请填写客户要价");
                            }
                            return false;
                        } else {
                            if (that.checkNum(that.customerInfo.customerAsk, "customerAsk", "1") == false) {
                                if (that.newPager == '1') {
                                    that.showToast("请输入正确的客户要价")
                                } else {
                                    alert("请输入正确的客户要价");
                                }
                                return false;
                            }
                        }
                        //定金金额，收款金额验证
                        if (that.checkNum(that.customerInfo.earnestMoney,'earnestMoney','1')== false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的定金金额")
                            } else {
                                alert("请输入正确的定金金额");
                            }
                            return false;
                        }
                        if (that.checkNum(that.customerInfo.amountCollect,'amountCollect','1')== false) {
                            if (that.newPager == '1') {
                                that.showToast("请输入正确的收款金额")
                            } else {
                                alert("请输入正确的收款金额");
                            }
                            return false;
                        }

                    }
                    if (that.customerInfo.intentionFlag == 1) {

                        if (that.customerInfo.existingDevice == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入现有设备")
                            } else {
                                alert("请输入现有设备");
                            }
                            return false;
                        }
                        if (that.customerInfo.workingExperience == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入从业经验")
                            } else {
                                alert("请输入从业经验");
                            }
                            return false;
                        }
                        if (that.customerInfo.buildCondition == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入工程情况")
                            } else {
                                alert("请输入工程情况");
                            }
                            return false;
                        }
                        if (that.customerInfo.revenueForecast == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入收入预测")
                            } else {
                                alert("请输入收入预测");
                            }
                            return false;
                        }
                        if (that.customerInfo.competitorCondition == '') {
                            if (that.newPager == '1') {
                                that.showToast("请输入竞争对手")
                            } else {
                                alert("请输入竞争对手");
                            }
                            return false;
                        }
                    }
                }




                that.customerInfo.createUserId = that.userId;
                var t = new Date();
                var nowYear = t.getFullYear();
                var nowMonth = t.getMonth() + 1;//0-11 0代表一月
                var nowDate = t.getDate();

                //根据购买时间判断预计成交日期
                switch (that.customerInfo.buyDate) {
                    case '七天内':
                        t.setDate(nowDate + 7);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '本月内':
                        that.customerInfo.yuJChJRQ = nowYear + '-' + (nowMonth >= 10 ? nowMonth : '0' + nowMonth) + '-' + that.getLastDate(nowYear, nowMonth);
                        break;
                    case '一月内':
                        t.setDate(nowDate + 30);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '三月内':
                        t.setMonth(nowMonth + 2);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                    case '丢单':
                        that.customerInfo.yuJChJRQ = '-1'
                        break;
                    case '已成交':
                        that.customerInfo.yuJChJRQ = '1'
                        break;
                    case '半年内':
                        t.setMonth(nowMonth + 5);
                        that.customerInfo.yuJChJRQ = t.getFullYear() + '-' + (t.getMonth() + 1 >= 10 ? t.getMonth() + 1 : '0' + (t.getMonth() + 1)) + '-' + (t.getDate() >= 10 ? t.getDate() : '0' + t.getDate());
                        break;
                }
                that.showProcess();
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.saveIntentCustomerInfo, that.customerInfo, function (data) {
                    console.log(data.records)
                    that.hideProcess();
                    if (data.records == '保存成功' && that.isAdd != 1) {
                        that.customerVisitToday.customerId = that.customerInfo.id;
                        delete that.customerVisitToday.createTime;

                        console.log(data.records)
                        if (data.records == '保存成功') {
                            if (that.newPager == '1') {
                                that.showToast("保存成功")
                            } else {

                                that.showSave("保存成功")
                            }
                            ;
                            if (that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                                if (that.newPager == '1') {
                                    if(getUrlParamObj().report ==  '1'){
                                        var param = {
                                            backRefresh: true,       //是否返回刷新
                                        }
                                        JSBridge.call(ROUTER, 'navigateBack', param)
                                    }else if(getUrlParamObj().report ==  '2'){
                                        var param = {
                                            backRefresh: false,       //工作报告是否为意向客户  进入！
                                        }
                                        JSBridge.call(ROUTER, 'navigateBack', param)
                                    }else {
                                        var param = {
                                            backRefresh: true,       //是否返回刷新
                                            data: 'someRefresh'
                                        }
                                        JSBridge.call(ROUTER, 'navigateBack', param)
                                    }
                                } else {
                                    var obj = {
                                        activity: 'closePage'
                                    }
                                    prompt(JSON.stringify(obj))
                                }

                            }
                            if (that.type == 'pcbb') {
                                parent.refresh();
                                api.close();
                            } else {
                                if (that.type == 'pc') {
                                    var pageId = top.getActivePageId();
                                    var $iframe = top.findIframeById(pageId);
                                    console.log($iframe[0].contentWindow.app.report.todayVisitCustomer[that.index])
                                    if (that.customerInfo.birthday) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].birthday = that.customerInfo.birthday
                                    }
                                    if (that.customerInfo.intentionFlag) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionFlag = that.customerInfo.intentionFlag
                                    }
                                    if (that.customerInfo.buildCondition) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                    }
                                    if (that.customerInfo.buyDate) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyDate = that.customerInfo.buyDate
                                    }
                                    if (that.customerInfo.buyType) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyType = that.customerInfo.buyType
                                    }
                                    if (that.customerInfo.chance) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].chance = that.customerInfo.chance
                                    }
                                    if (that.customerInfo.cityName) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].cityName = that.customerInfo.cityName
                                    }
                                    if (that.customerInfo.competitorCondition) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].competitorCondition = that.customerInfo.competitorCondition
                                    }
                                    if (that.customerInfo.countyName) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].countyName = that.customerInfo.countyName
                                    }
                                    if (that.customerInfo.customerCredit) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerCredit = that.customerInfo.customerCredit
                                    }
                                    if (that.customerInfo.customerType) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerType = that.customerInfo.customerType
                                    }
                                    if (that.customerInfo.deviceUse) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].deviceUse = that.customerInfo.deviceUse
                                    }
                                    if (that.customerInfo.existingDevice) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].existingDevice = that.customerInfo.existingDevice
                                    }
                                    if (that.customerInfo.intentionBrand) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionBrand = that.customerInfo.intentionBrand
                                    }
                                    if (that.customerInfo.intentionModel) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionModel = that.customerInfo.intentionModel
                                    }
                                    if (that.customerInfo.name) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].name = that.customerInfo.name
                                    }
                                    if (that.customerInfo.revenueForecast) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].revenueForecast = that.customerInfo.revenueForecast
                                    }
                                    if (that.customerInfo.source) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].source = that.customerInfo.source
                                    }
                                    if (that.customerInfo.tel) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].tel = that.customerInfo.tel
                                    }
                                    if (that.customerInfo.provinceName) {
                                        $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].provinceName = that.customerInfo.provinceName
                                    }
                                    console.log($iframe[0].contentWindow.app.report.todayVisitCustomer[that.index])
                                    api.close();
                                } else {
                                    var pageId = top.getActivePageId();
                                    var $iframe = top.findIframeById(pageId);
                                    for (var i = 0; i < $iframe[0].contentWindow.app.report.todayVisitCustomer.length; i++) {
                                        if (that.customerId == $iframe[0].contentWindow.app.report.todayVisitCustomer[i].customerId) {
                                            that.index = i;
                                        }
                                    }
                                    if (that.index) {
                                        if (that.customerInfo.birthday) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].birthday = that.customerInfo.birthday
                                        }
                                        if (that.customerInfo.intentionFlag) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionFlag = that.customerInfo.intentionFlag
                                        }
                                        if (that.customerInfo.buildCondition) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                        }
                                        if (that.customerInfo.buildCondition) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buildCondition = that.customerInfo.buildCondition
                                        }
                                        if (that.customerInfo.buyDate) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyDate = that.customerInfo.buyDate
                                        }
                                        if (that.customerInfo.buyType) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].buyType = that.customerInfo.buyType
                                        }
                                        if (that.customerInfo.chance) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].chance = that.customerInfo.chance
                                        }
                                        if (that.customerInfo.cityName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].cityName = that.customerInfo.cityName
                                        }
                                        if (that.customerInfo.competitorCondition) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].competitorCondition = that.customerInfo.competitorCondition
                                        }
                                        if (that.customerInfo.countyName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].countyName = that.customerInfo.countyName
                                        }
                                        if (that.customerInfo.customerCredit) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerCredit = that.customerInfo.customerCredit
                                        }
                                        if (that.customerInfo.customerType) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].customerType = that.customerInfo.customerType
                                        }
                                        if (that.customerInfo.deviceUse) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].deviceUse = that.customerInfo.deviceUse
                                        }
                                        if (that.customerInfo.existingDevice) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].existingDevice = that.customerInfo.existingDevice
                                        }
                                        if (that.customerInfo.intentionBrand) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionBrand = that.customerInfo.intentionBrand
                                        }
                                        if (that.customerInfo.intentionModel) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].intentionModel = that.customerInfo.intentionModel
                                        }
                                        if (that.customerInfo.name) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].name = that.customerInfo.name
                                        }
                                        if (that.customerInfo.revenueForecast) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].revenueForecast = that.customerInfo.revenueForecast
                                        }
                                        if (that.customerInfo.source) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].source = that.customerInfo.source
                                        }
                                        if (that.customerInfo.tel) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].tel = that.customerInfo.tel
                                        }
                                        if (that.customerInfo.provinceName) {
                                            $iframe[0].contentWindow.app.report.todayVisitCustomer[that.index].provinceName = that.customerInfo.provinceName
                                        }
                                        parent.app.refreshList();
                                        api.close();
                                    } else {
                                        parent.app.refreshList();
                                        api.close();
                                    }
                                }

                            }
                            //返回列表页
                        } else {
                            if (that.newPager == '1') {
                                that.showToast("保存失败")
                            } else {
                                alert("保存失败");
                            }
                            return false;
                        }
                    } else if (data.records == '电话号码已存在') {
                        if (that.newPager == '1') {
                            that.showToast("电话号码已存在")
                        } else {
                            alert("电话号码已存在")
                        }
                        return false
                    } else {
                        if (that.newPager == '1') {
                            that.showToast("保存成功")
                        } else {
                            that.showSave("保存成功")
                        }
                        var obj = {
                            activity: 'closePage'
                        }
                        if (that.type != 'pc' && that.type != 'pcList' && that.type != 'pcbb') {
                            if (that.newPager == '1') {
                                var param = {
                                    backRefresh: true,       //是否返回刷新
                                    data: 'someRefresh'
                                }
                                JSBridge.call(ROUTER, 'navigateBack', param)
                            } else {
                                prompt(JSON.stringify(obj))
                            }
                        } else {
                            parent.app.refreshList();
                            api.close();
                        }
                        return false;
                    }
                });
            },
            showModel: function (width, title) {
                top.$.alert({type: 'topAlert', width: width, title: title})
//                var txt = "hello World 弹框内容";
//                top.$.alert({
//                    win:this,
//                    height:220,
//                    icon:'1', //1成功 2失败 3提示 不穿代表无图标
//                    title:'弹框标题',
//                    content: '<p>' + txt +'</p>',
//                    effect: $(event.currentTarget).attr('data-flag'),
//                    blankclose: true,//点击空白是否可关闭
//                    ok:"确定",//是否显示确认按钮,
//                    okCallback:function () {
//                        //确认按钮回调
//                        console.log(this)
//                        console.log("确定回调")
//                        console.log(this.win.myWorkList)
//                    },
//                    cancel:"取消"
//                })
            },
            //获取本月最后一天
            getLastDate: function (year, month) {
                var d = new Date(0);
                if (month == 12) {
                    d.setUTCFullYear(year + 1);
                    d.setUTCMonth(0);
                } else {
                    d.setUTCFullYear(year);
                    d.setUTCMonth(month);
                }
                d.setTime(d.getTime() - 1);
                ds = d.getUTCDate() >= 10 ? d.getUTCDate() : '0' + d.getUTCDate();
                return ds;
            },
            showDz: function () {
                var html = '';
                if (this.customerInfo.provinceName) {
                    html += this.customerInfo.provinceName;
                }
                if (this.customerInfo.cityName != '') {
                    html += "-" + this.customerInfo.cityName;
                }
                if (this.customerInfo.countyName != '') {
                    html += "-" + this.customerInfo.countyName;
                }
                return html;
            },
            getBran: function () {
                var that = this;
                $.wyui.postMethod('/deviceBrand/getBrandByCompanyId.json', {'companyId': that.userInfo.companyId}, function (r) {
                    that.itemsBran = r.brands;
                    that.getModel('1');
                }, true)
            },
            getModel: function (type) {
                var that = this;
                var brandId;
                if (type != '1') {
                    that.customerInfo.intentionModel = '';
                    that.checkedModelCustomerLists = []
                }
                console.log(that.itemsBran)
                for (var i = 0; i < that.itemsBran.length; i++) {
                    console.log(that.customerInfo.intentionBrand, that.itemsBran[i].brandName)
                    if (that.customerInfo.intentionBrand == that.itemsBran[i].brandName) {
                        brandId = that.itemsBran[i].id
                    }
                }
                $.wyui.postMethod('/deviceBrand/getDeviceTypeList.json', {
                    brandId: brandId,
                    companyId: that.userInfo.companyId
                }, function (r) {
                    that.itemsDeviceType = r.devicetypes;
                    console.log(that.itemsDeviceType)
                    for (var i = 0; i < that.itemsDeviceType.length; i++) {
                        that.itemsDeviceType[i].itemsMod = []
                    }
                }, true);
                for (var j = 0; j < that.itemsDeviceType.length; j++) {
                    that.getModelByType(that.itemsDeviceType[j]);
                }
            },
            getModelByType: function (item) {
                var that = this;
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getModelByBrandName, {
                    'brandName': that.customerInfo.intentionBrand,
                    'deviceTypeId': item.id
                }, function (r) {
                    if (r.modelInfo) {
                        item.itemsMod = r.modelInfo;
                    }
                }, true)
                console.log(that.itemsDeviceType)
            },
            showBuyDate: function (item) {
                var that = this;
                var buyDate = item.buyDate;
                return that.buyDateObj.get(buyDate);
                //that.buyDateList;
            },
            getCity: function (id) {
                var that = this;
                $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                    'id': id,
                    'userId': that.userId
                }, function (r) {
                    that.cityList = r.records;
                })
            }
            ,
            getCounty: function (id) {
                var that = this;
                $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                    'id': id,
                    'userId': that.userId
                }, function (r) {
                    console.log(r);
                    that.countyList = r.records;
                })

            },
            selectAddress: function (id) {
                if (this.type == 'pc' || this.type == 'pcList' || this.type == 'pcbb') {

                } else {
                    var obj = {
                        type: 'chooseAddress',
                        id: id,
                    }
                    if (this.type != 'pc' && this.type != 'pcList' && this.type != 'pcbb') {
                        prompt(JSON.stringify(obj))
                    }
                }
            },
            isObjectValueEqual: function (x, y) {
                var i, l, leftChain, rightChain;

                function compare2Objects(x, y) {
                    var p;

                    // remember that NaN === NaN returns false
                    // and isNaN(undefined) returns true
                    if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') {
                        return true;
                    }

                    // Compare primitives and functions.
                    // Check if both arguments link to the same object.
                    // Especially useful on the step where we compare prototypes
                    if (x === y) {
                        return true;
                    }

                    // Works in case when functions are created in constructor.
                    // Comparing dates is a common scenario. Another built-ins?
                    // We can even handle functions passed across iframes
                    if ((typeof x === 'function' && typeof y === 'function') ||
                        (x instanceof Date && y instanceof Date) ||
                        (x instanceof RegExp && y instanceof RegExp) ||
                        (x instanceof String && y instanceof String) ||
                        (x instanceof Number && y instanceof Number)) {
                        return x.toString() === y.toString();
                    }

                    // At last checking prototypes as good as we can
                    if (!(x instanceof Object && y instanceof Object)) {
                        return false;
                    }

                    if (x.isPrototypeOf(y) || y.isPrototypeOf(x)) {
                        return false;
                    }

                    if (x.constructor !== y.constructor) {
                        return false;
                    }

                    if (x.prototype !== y.prototype) {
                        return false;
                    }

                    // Check for infinitive linking loops
                    if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1) {
                        return false;
                    }

                    // Quick checking of one object being a subset of another.
                    // todo: cache the structure of arguments[0] for performance
                    for (p in y) {
                        if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
                            return false;
                        } else if (typeof y[p] !== typeof x[p]) {
                            return false;
                        }
                    }

                    for (p in x) {
                        if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
                            return false;
                        } else if (typeof y[p] !== typeof x[p]) {
                            return false;
                        }

                        switch (typeof (x[p])) {
                            case 'object':
                            case 'function':

                                leftChain.push(x);
                                rightChain.push(y);

                                if (!compare2Objects(x[p], y[p])) {
                                    return false;
                                }

                                leftChain.pop();
                                rightChain.pop();
                                break;

                            default:
                                if (x[p] !== y[p]) {
                                    return false;
                                }
                                break;
                        }
                    }

                    return true;
                }

                if (arguments.length < 1) {
                    return true; //Die silently? Don't know how to handle such case, please help...
                    // throw "Need two or more arguments to compare";
                }

                for (i = 1, l = arguments.length; i < l; i++) {

                    leftChain = []; //Todo: this can be cached
                    rightChain = [];

                    if (!compare2Objects(arguments[0], arguments[i])) {
                        return false;
                    }
                }

                return true;
            }

        },
        watch: {
            customerInfo: {
                deep: true,
                handler: function (newVal, oldVal) {
                    var that = this;
                    that.yuce = getUrlParamObj().yuce;
                    if (that.yuce == '1') {
                        if (that.pageType == 'edit') {
                            if (that.isObjectValueEqual(newVal, that.oldCustomerInfo)) {
                                that.editBtn = false;
                            } else {
                                that.editBtn = true;
                            }
                        }
                    } else {
                        that.editBtn = true;
                    }
                }
            }
        },
        mounted: function () {
            var that = this;
            if (getUrlParamObj().isAdd != 1) {
                that.showProcess();
                that.getCustomerInfoById();
            }
            $.wyui.postMethod(urlConfig.system.user.getUserViewById, {id: that.userId}, function (r) {
                console.log(r)
                that.userInfo = r;
            }, true);
            that.index = getUrlParamObj().index;
            $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {
                'id': '0',
                'userId': that.userId
            }, function (r) {
                console.log(r);
                that.provinceList = r.records;

            });
            $.wyui.postMethod('/enum2/selectByModuleType.json', {moduleType: 'buyDate'}, function (r) {
                var list = r;
                that.buyDateList = r;
                if (list && list.length > 0) {
                    that.buyDateObj = new Map();
                    for (var i = 0; i < list.length; i++) {
                        var k = list[i].key;
                        var v = list[i].value;

                        that.buyDateObj.set(k, v);
                    }
                }
                //that.buyDateObj = r;
            }, true);
            that.getBran();
            that.getRegionByAddress();
            that.getGenZrByRegionId();

        }
    })
</script>
<script>
    if (app.type && (app.type == "pc" || app.type == "pcList" || app.type == "pcbb")) {
        var api = frameElement.api, W = api.opener;
    }

    function setAddress(addressObj, domId) {
        app.customerInfo.provinceName = addressObj.provinceName
        app.customerInfo.cityName = addressObj.cityName
        app.customerInfo.countyName = addressObj.countyName
    }
</script>
</body>
</html>
